<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    <style>
        body {
            font-family: 'Comic Sans MS', cursive, sans-serif;
            background-color: #ffcccc; /* 粉红色背景 */
            color: #333;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-image: url('https://example.com/piggy.png'); /* 猪猪侠背景图片 */
            background-size: cover;
            background-position: center;
        }
        #app {
            background-color: #fff;
            padding: 20px;
            border-radius: 20px; /* 圆润的边角 */
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            width: 300px;
            text-align: center;
            animation: fadeIn 1s ease-in-out; /* 渐入动画 */
        }
        textarea {
            width: 100%;
            height: 100px;
            padding: 10px;
            margin-bottom: 10px;
            border: 2px solid #ff69b4; /* 粉红色边框 */
            border-radius: 20px; /* 圆润的边角 */
            font-size: 16px;
            background-color: #fff;
            box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
        }
        input[type="button"] {
            width: 100%;
            padding: 10px;
            background: linear-gradient(to bottom, #ff69b4, #ff1493); /* 渐变色背景 */
            color: #fff;
            border: none;
            border-radius: 20px; /* 圆润的边角 */
            font-size: 16px;
            cursor: pointer;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
            transition: background 0.3s ease;
        }
        input[type="button"]:hover {
            background: linear-gradient(to bottom, #ff1493, #ff69b4); /* 鼠标悬停时的渐变色 */
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
    </style>
</head>
<body>
<div id="app">
    <el-input
            type="textarea"
            :rows="4"
            placeholder="说点儿啥..."
            v-model="weibo.content"
            style="width: 100%; margin-bottom: 10px;"
    ></el-input>
    <el-button type="primary" @click="insert" style="background: linear-gradient(to bottom, #ff69b4, #ff1493); border: none;">
        发微博
    </el-button>
</div>
</body>
<!--引入axios和vue框架文件-->
<script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
    let v = new Vue({
        el: '#app',
        data: function () {
            return {
                dialogImageUrl: '',
                dialogVisible: false,
                weibo: { content: "" },
                fileList: []
            }
        },
        methods: {
            insert() {
                // 发出发微博的请求
                axios.post("/v1/weibo/insert", v.weibo).then(function (response) {
                    if (response.data == 1) {
                        location.href = "/"; // 回到首页
                    } else {
                        alert("请先登录!");
                        location.href = "/login.html";
                    }
                });
            }
        }
    });
</script>
</html>
